package com.xiaoyu.lanling.feature.user.viewholder

import `in`.srain.cube.views.list.ViewHolderBase
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.facebook.drawee.view.SimpleDraweeView
import com.xiaoyu.base.utils.extensions.dp
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.feature.user.model.FeedImageItem
import com.xiaoyu.lanling.media.image.ImageLoadParam
import com.xiaoyu.lanling.media.image.ImageViewUtil

class FeedOverviewViewHolder: ViewHolderBase<FeedImageItem>() {

    private lateinit var image:SimpleDraweeView

    override fun createView(layoutInflater: LayoutInflater, parent: ViewGroup): View {
        val rootView = layoutInflater.inflate(R.layout.user_feed_image_overview_item,parent,false)
        image = rootView as SimpleDraweeView
        return rootView
    }

    override fun showData(position: Int, itemData: FeedImageItem) {
        ImageViewUtil.loadImage(image,ImageLoadParam.newBuilder().setUrl(itemData.image).setSize(72.dp).setCornersRadius(4.dp).build())
    }
}